<?php


namespace App\Transformers\Product;


use App\Models\ProductAttrValue;
use League\Fractal\TransformerAbstract;

class ProductAttrValueTransformer extends TransformerAbstract
{

    public function transform(ProductAttrValue $data)
    {
        return [
            'id' => $data->id,
            'product_id' => $data->product_id ?? '',
            'suk' => $data->suk ?? '',
            'stock' => $data->stock ?? '',
            'sales' => $data->sales ?? '',
            'price' => $data->price ?? '',
            'image' => $data->image ?? '',
            'unique' => $data->unique ?? '',
            'cost' => $data->cost ?? '',
            'bar_code' => $data->bar_code ?? '',
            'ot_price' => $data->ot_price ?? '',
            'vip_price' => $data->vip_price ?? '',
            'weight' => $data->weight ?? '',
            'volume' => $data->volume ?? '',
            'brokerage' => $data->brokerage ?? '',
            'brokerage_two' => $data->brokerage_two ?? '',
            'type' => $data->type ?? '',
            'type_text' => $data->typeTypeEnum[$data->type] ?? '',
            'quota' => $data->quota ?? '',
            'quota_show' => $data->quota_show ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }



}
